#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2020/10/27 22:32
# @Author  : LJ
# @Site    :
# @File    : 第二周_第二节tmp.py
# @Software: PyCharm


# 字符窜crud操作哦
# 'a' + 'b' =>
# 'ab'
str = "test"
str = str + 'a'
print(str)

# 检索
print(str.find("e"))
print(str.index("e"))
print(str.startswith('t'))
print(str.endswith('t'))
print(str[:])
print(str[1:])
print(str[-1])
print(str[:-1])
#更新
print(str.replace('t','1'))
print(str.split('e'))
print(str.join(' '))
#删除
str1 = "   123   "
print(str1.strip())
print(str1.rstrip())
print(str1.lstrip())
str = "你好"
str1 = "世界"
print(f'{str},{str1}')

f = open('第二周_第二节tmp.py','r' ,encoding='utf-8')
data = f.read()
print(data)
f2 = open('第二周_第二节.py','w',encoding='utf-8')
f2.write(data)
f.close()
f2.close()